package com.ysx.teacher.day20210907.constructors.ch01;

public class Student {

    private String name;
    private int age;
    private int salary;
    private char gender;

    public int add(int x, int y){
        int sum = x+y;
        return sum;
    }

    public Student() {
        int sum= add(10,10);
        System.out.println("创建1个对象成功... 计算的结果="+sum );
    }


    public Student(String name, int age, int salary, char gender) {
        this();
        this.name = name;
        this.age = age;
        this.salary = salary;
        this.gender = gender;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", salary=" + salary +
                ", gender=" + gender +
                '}';
    }
}
